package Day15;

/**
 * @Author kalista
 * @Description
 * @Date 2020/11/23  11:28
 **/
public class MyThread extends Thread{

    @Override
    public void run() {

        System.out.println("我是MyThread------1");
        System.out.println("我是MyThread------2");
        System.out.println("我是MyThread------3");

        MyThread2 myThread2 = new MyThread2();
        myThread2.start();
        try {
            myThread2.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println("我是MyThread------4");
        System.out.println("我是MyThread------5");
        System.out.println("我是MyThread------6");
    }


    public static void main(String[] args) {
        MyThread myThread  = new MyThread();
        //设置线程的名字
        myThread.setName("t1");
        //设置优先级
        //最低优先级为1
        //最高的优先级为0
        //默认优先级为5
        myThread.setPriority(10);

        myThread.start();

    }
}


class MyThread2 extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println("我是MyThread2-----》" + i);
        }
    }
}